import java.util.ArrayList;
import java.util.List;

import javax.swing.table.AbstractTableModel;


@SuppressWarnings("serial")
public class ModeleTableau extends AbstractTableModel {
	private final String[] entetes = {"DATE","NOM","MONTANT"};
	private final List<Transac> t = new ArrayList<Transac>();
	
	public int getColumnCount() {
		return entetes.length;
	}

	public String getColumnName(int column){
		return entetes[column];
	}
	
	public int getRowCount() {
		return t.size();
	}

	public Object getValueAt(int row, int column) {
		switch(column){
		case 0:
			return t.get(row).getId();
		case 1:
			return t.get(row).getNom();
		case 2:
			return t.get(row).getMontant();
		default:
			return null;
		}
	}

	public void addT(Transac transaction){
		t.add(transaction);
		fireTableRowsInserted(t.size() - 1 , t.size() -1);
	}
	
}
